<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
$editor =& JFactory::getEditor();
$started1 = strtotime($this->item->started);
$started2 = date('d-m-Y',$started1);
$finished1 = strtotime($this->item->finished);
$finished2 = date('d-m-Y',$finished1);
?>
<form action="<?php echo JRoute::_('index.php?option=com_shop'); ?>"   method="post" name="adminForm" enctype="multipart/form-data">
<div class="width-60 fltlft">
		<fieldset class="adminform">
			<legend>Nhập thông tin tuyển dụng</legend>
			<ul class="adminformlist">
				<li><label id="title" for="" class="required" title="">Tiêu đề<span class="star">&nbsp;*</span></label>
                <input type="text" name="title" id="title" value="<?php echo $this->item->title; ?>" class="inputbox required" size="50"  aria-required="true" required="required"></li>
                <label id="state" for="state">Bật</label>
			<select name="state" class="inputbox">
				<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
				<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->item->state, true);?>
			</select>
                </li>
                <li>
                <label id="catid" for="">Chọn ngành nghề</label>
                <select name="catid" id="catid">
                	<option value="">Chọn ngành ...</option>
                	<?php echo JHtml::_('select.options', $this->getOptions(), 'value', 'text', $this->item->address_id, true);?>
                </select>
                </li>
                 <li>
                <label id="company" for="company">Chọn công ty</label>
                <select name="company" id="company">
                	<option value="">Chọn công ty ...</option>
                	<?php echo JHtml::_('select.options', $this->getCompanys(), 'value', 'text', $this->item->company, true);?>
                </select>
                </li>
                <li>
                <label id="address_id" for="">Địa chỉ</label>
                <select name="address_id" id="address_id">
                	<option value="">Chọn địa chỉ ...</option>
                	<?php echo JHtml::_('select.options', $this->getAddresses(), 'value', 'text', $this->item->address_id, true);?>
                </select>
                </li>
                <li> <label for="started">Ngày bắt đầu</label><?php echo JHTML::_('calendar', $started2, 'started', 'started', "%d-%m-%Y"); ?></li>
                <li> <label for="finished">Ngày kết thúc</label><?php echo JHTML::_('calendar', $finished2, 'finished', 'finished', "%d-%m-%Y"); ?></li>
			</ul>
            <div class="clr"></div>
             <label>Thông tin chung</label>
            <div class="clr"></div>
            <?php 
			echo $editor->display('text', $this->item->text , '100%', '300', '60', '20', true);
			
			?>
            <div class="clr"></div>
		</fieldset>
</div>
<div class="width-40 fltrt">

</div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $this->item->id; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script>
Joomla.submitbutton = function(task)
{
	if (task == '')
	{
		return false;
	}
	else
	{
		var action = task.split('.');
		if (action[1] != 'cancel' && action[1] != 'close')
		{
			var $frm = document.adminForm;
			if($frm.title.value == '')
			{
				alert('Nhập tiêu đề sản phẩm đăng bán');
				$frm.title.focus();
				return false;
			}
			else
			{
				Joomla.submitform(task);
				return true;
			}
		}
		else
			{
				Joomla.submitform(task);
				return true;
			}
	}
}
</script>
